home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CTOOLS10.ARJ / HASHADD.C < prev    next >
C/C++ Source or Header  |  1991-12-31  |  1KB  |  53 lines

  1. /****************************************************************************
  2. *
  3. *                    Copyright (C) 1991 Kendall Bennett.
  4. *                            All rights reserved.
  5. *
  6. * Filename:        $RCSfile: hashadd.c $
  7. * Version:        $Revision: 1.3 $
  8. *
  9. * Language:        ANSI C
  10. * Environment:    any
  11. *
  12. * Description:    Simple hash function for strings
  13. *
  14. * $Id: hashadd.c 1.3 91/12/31 19:40:07 kjb Exp $
  15. *
  16. * Revision History:
  17. * -----------------
  18. *
  19. * $Log:    hashadd.c $
  20. * Revision 1.3  91/12/31  19:40:07  kjb
  21. * Modified include file directories.
  22. * Revision 1.2  91/09/01  16:48:11  ROOT_DOS
  23. * Changed include file search to search current directory
  24. * Revision 1.1  91/08/16  13:15:06  ROOT_DOS
  25. * Initial revision
  26. ****************************************************************************/
  27.  
  28. #include "debug.h"
  29. #include "hash.h"
  30.  
  31. PUBLIC unsigned hash_add(unsigned char *name)
  32. /****************************************************************************
  33. *
  34. * Function:        hash_add
  35. * Parameters:    name    - String to hash
  36. * Returns:        hash value of the string
  37. *
  38. * Description:    This hash function simply adds together the characters
  39. *                in the name.
  40. *
  41. ****************************************************************************/
  42. {
  43.     unsigned    h;
  44.  
  45.     for (h = 0; *name; h += *name++)
  46.         ;
  47.  
  48.     return h;
  49. }
  50.